<%@ page contentType="text/html; charset=UTF-8"%>
<%@page import="edu.ccut.saturn.component.SaturnData"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="/extjs/include/all.jsp"%>
<title></title>
<script type="text/javascript">
Ext.onReady(function(){
	var resultWidth = Ext.get("process-grid").getWidth();
	var store = new Ext.data.JsonStore({
		    url: '${pageContext.request.contextPath}/edu.ccut.saturn.workflow.manager::/releaseManagerModule/action/QueryProDef.action',
		    root: 'result',
		    totalProperty:'count',
		    fields: [
	               {name: 'process_xml_key', mapping: 'process_xml_key'},
	               {name: 'name', mapping: 'name'},
	               {name: 'state', mapping: 'state'}
	           ]
		});
		store.load();
	 var grid = new Ext.grid.GridPanel({
	    	frame:true,
	        title: '流程发布管理',
       	    store: store,
       	    bodyStyle:'width:100%',
	        columns: [	 
	            {header: "流程定义名称",width: resultWidth*0.5,dataIndex: 'process_xml_key', sortable: true,renderer:showVersion},
	            {header: "流程定义名称",width: resultWidth*0.2, dataIndex: 'name', sortable: true},
	            {header: "是否存在发布版本",width: resultWidth*0.3, dataIndex: 'state', sortable: true,renderer:showState}
	        ],
	        renderTo:'process-grid',
	        height:400,
	        frame:true,
	        loadMask: {msg:'正在加载数据，请稍侯……'},
           bbar: new Ext.PagingToolbar({ 
	            pageSize: 20, 
	            store: store, 
	            displayInfo: true, 
	            displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
	            emptyMsg: "没有数据显示" 
	    }) 
    });
		
	function showVersion(process_xml_key){
		return "<a href='releaseOperation.jsp?process_xml_key="+process_xml_key+"'>"+process_xml_key+"</a>";
	}
	
	function showState(value){
		if(value=='1'){
			return "存在";
		}else{
			return "不存在";
		}
	}	
})
</script>
</head>
<body>
<div id="process-grid" width="100%"></div>
</body>
</html>